package com.nightsoul.groovy

public class GPathTest{

	public static void main(def args){
		def ulcDate = new Date(107, 0, 1);
		def ulc = new Product(dollar:1499, name:"ULC");
		def ve = new Product(dollar:499, name:"Visual Editor");
		
		def invoices = [
		    new Invoice(
		    		date:ulcDate,
		    		items:[
		    		       new LineItem(count:5, product:ulc),
		    		       new LineItem(count:1, product:ve)
		    		]),
    		new Invoice(
		    		date:[107,1,2],
		    		items:[
		    		       new LineItem(count:4, product:ve)
		    		])
		    ];
		
		//println invoices.items*.total();
		test(*invoices);
	}
	
	
	static def test(item1, item2) {
		println item1;
		println item2;
	}
}

class Invoice {
	List items;
	Date date;
}

class LineItem {
	Product product;
	int count;
	int total() {
		return product.dollar * count;
	}
}

class Product {
	String name;
	def dollar;
}
